<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <div>
        <h1>原型:</h1>
        <p>原型是function 对象的一个属性,它定义了构造函数制造出来的对象的公共祖先.通过该构造函数产生的对象,
            可以继承该原型的属性和方法.原型也是对象
        </p>
        <p>利用原型特点和概念,可以提取共有属性.</p>
        <p>对象如何查看原型 ----> 隐式属性 _proto_</p>
        <p>对象如何查看对象的构造函数 --->  constructor</p>
    </div>
</body>
</html>

<script>
    // Person.prototype = {
    //     name:'abc'

    // }
    // function Person() {
    //     // var this = {
    //     //     __proto__: Person.prototype
    //     // }
    // }
    // let obj = {
    //     name: 'sunny'
    // }
    // let person = new Person();

    Person.prototype.name = 'sunny';
    function Person(){}
    Person.prototype = {
        name : 'cherry'
    }
    var person = new Person();
    console.log(person.__proto__); //cherry



    Grand.prototype.lastName = 'Deng';
    function Grand (){}
    let grand = new Grand();
    Father.prototype = grand;
    function Father(){
        this.name = "xuming";
        this.forture = {
            card:'123'
        }
    }
    let father = new Father();
    Son.prototype = father;
    function Son () {
        this.hobbit = "smoke";
    }
    let son = new Son ();


    Person.prototype = {
        name : 'a',
        sayName : function () {
            console.log(this.naem);
        } 
    }
    function Person (){
        this.name = 'b';
    }
    Object.create(null)
    

</script>